<!DOCTYPE html>
<html>
<head>
    <style>
        :root {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        body {
            font-family: Roboto, sans-serif;
            -webkit-app-region: drag;
            overflow: hidden;
        }
        body.dark {
            background-color: #212121;
        }
        body.light {
            background-color: #f6f6f6;
        }
        img {
            width: auto;
            height: 250px;

            padding-left: 16px;
            padding-top: 18px;
            pointer-events: none;
        }
    </style>
</head>

<body >
    <img id="dark" src="icon.png">

    <script>
        const fs = require("fs").promises;
        const path = require("path");
        let SETTINGS;
        if (process.platform === "win32")
            SETTINGS = path.join(process.env.HOMEDRIVE, process.env.HOMEPATH, ".bridge/data/settings");
        else
            SETTINGS = path.join(process.env.HOME, ".bridge/data/settings");

        fs.readFile(SETTINGS)
            .then(str => JSON.parse(str.toString()))
            .then(({ is_dark_mode }) => setMode(is_dark_mode ? 'dark' : 'light'))
            .catch((err) => {
                setMode();
            });

        function setMode(mode="dark") {
            document.body.classList.add(mode);
        }
    </script>
</body>
</html>